package com.itheima.demo01;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

public class Test02 {
    public static void main(String[] args) {

        ArrayList<String> list = new ArrayList<>();
        list.add("zhangsan,24");
        list.add("lisi,25");
        list.add("wangwu,26");

        Map<String, Integer> collect1 = list.stream().filter(s -> Integer.parseInt(s.split(",")[1]) > 24).collect(Collectors.toMap(new Function<String, String>() {
            @Override
            public String apply(String k) {
                return k.split(",")[0];
            }
        }, new Function<String, Integer>() {
            @Override
            public Integer apply(String v) {
                return Integer.parseInt(v.split(",")[1]);
            }
        }));

        System.out.println(collect1);
    }
}
